﻿namespace WLFramework.Common
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;

    /// <summary>
    /// 数值操作的辅助方法
    /// </summary>
    public static class NumberHelper
    {
        /// <summary>
        /// 构造范围 开始数字到结尾数字（不包括结尾数字） 增量1
        /// </summary>
        /// <param name="end"></param>
        /// <param name="start"></param>
        /// <returns></returns>
        public static IEnumerable<int> GenerateRange(this int end, int start)
        {
            Shield.AssertIsTrue(start <= end);

            for (; start < end; start++)
            {
                yield return start;
            }
        }
    }
}
